package com.xh.web.controller;


import com.xh.web.constant.AjaxResult;
import com.xh.web.domain.DColumnImport;
import com.xh.web.service.IDColumnImportService;
import com.xh.web.util.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 导入临时字段Controller
 * 
 * @author fulan
 * @date 2020-09-14
 */
@RestController
@RequestMapping("/db/import/column")
public class DColumnImportController extends BaseController
{
    @Autowired
    private IDColumnImportService dColumnImportService;

    /**
     * 查询导入临时字段列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DColumnImport dColumnImport)
    {
        startPage();
        List<DColumnImport> list = dColumnImportService.selectDColumnImportList(dColumnImport);
        return getDataTable(list);
    }

    /**
     * 导出导入临时字段列表
     */
    @GetMapping("/export")
    public AjaxResult export(DColumnImport dColumnImport)
    {
        /*List<DColumnImport> list = dColumnImportService.selectDColumnImportList(dColumnImport);
        ExcelUtil<DColumnImport> util = new ExcelUtil<DColumnImport>(DColumnImport.class);
        return util.exportExcel(list, "import");*/
        return  null;
    }

    /**
     * 获取导入临时字段详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(dColumnImportService.selectDColumnImportById(id));
    }

    /**
     * 新增导入临时字段
     */
    @PostMapping
    public AjaxResult add(@RequestBody DColumnImport dColumnImport)
    {
        return toAjax(dColumnImportService.insertDColumnImport(dColumnImport));
    }

    /**
     * 修改导入临时字段
     */
    @PutMapping
    public AjaxResult edit(@RequestBody DColumnImport dColumnImport)
    {
        return toAjax(dColumnImportService.updateDColumnImport(dColumnImport));
    }

    /**
     * 删除导入临时字段
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(dColumnImportService.deleteDColumnImportByIds(ids));
    }
}
